<template>
    <view>
        <!-- #ifdef MP-WEIXIN --> 
        <top-nav :inner-title="title" is-show-back="true" is-fixed="true" :navH="navH" :n="n" is-white="bg-white" opacity="1"></top-nav>
        <view :style="{height:navH + 'px'}"></view>
        <!-- #endif -->
        <view class="item_content store">
            <view class="item_top flex" :src="store_info.img_path" @click='goStore()'>
                <image class="face_img"></image>
                <view class="item_right">
                    <view class="item_row flex">
                        <view class="dark_text arr_time ellipsis">{{store_info.shop_name}}</view>
                        
                    </view>
                </view>
            </view>
            <view class="item_bottom flex column">
                <view class="flex dark_text store_comment">{{store_comment[mine_score.score]}}</view>
                <view class="star_con">
                    <icon :class=" item < mine_score.score ? 'star_yellow' : 'star_gray'" v-for="item in 5" @click="chooseStoreStars($event)" :data-index="item+1" :key="item"></icon>
                </view>
                <view class="flex column detail_star" v-if="mine_score.score>0">
                    <view class="item flex">
                        <view class="light_text ti">包装</view>
                        <view class="star_con">
                            <icon :class=" item < mine_score.pack ? 'star_yellow' : 'star_gray'" v-for="item in 5" @click="choosePacketStars($event)" :data-index="item+1" :key="item"></icon>
                        </view>
                        <view class="light_text">{{store_comment[mine_score.pack]}}</view> 
                    </view>
                    <view class=" item flex">
                        <view class="light_text ti">味道</view>
                        <view class="star_con">
                            <icon :class=" item < mine_score.taste ? 'star_yellow' : 'star_gray'" v-for="item in 5" @click="chooseTasteStars($event)" :data-index="item+1" :key="item"></icon>
                        </view>
                        <view class="light_text">{{store_comment[mine_score.taste]}}</view> 
                    </view>
                </view>
                
              
            </view>   
        </view>
    </view>
    
</template>

<script>
    import uniFly    from 'unifly';
    import request   from '../../../common/request.js';
    import $api_base from '../../../api/api_base.js';
    import topNav    from '../../../template/topnav/index.vue';
    import event     from '../../../common/event.js';
    export default {
    	components: { topNav },
    	data() {
    		return {
    			navH: 0,
    			n: 0,
    			title:'我的评价',
                order_id:0,
                u_id:0,
                s_id:0,
                store_info:{},
                mine_score:{},
                store_comment:[ '','“非常差”', '“差”', '“一般”', '“满意”','“超赞”'],
    		}
    	},
    	onLoad: function (options) {
            console.log(options);
    		this.navH	  = getApp().globalData.navHeight;
    		this.n		  = getApp().globalData.n;
            this.order_id = options.order_no || 0;
            this.s_id = options.storeId || 0;
            this.u_id = uni.getStorageSync('openid');
            this.loadComentInfo();
    	},
    	methods:{
            loadComentInfo:function(){
                var self = this;
                $api_base.post($api_base.mineEvaluation,{order_id: self.order_id,u_id: self.u_id,s_id: self.s_id}).then(function(res) {
                    let data = res.data;
                    if (data.ok == 1) {
                        self.store_info = data.data.store_info;
                        self.mine_score = data.data.mine_score;
                    }else{
                        
                    }
                })
            },
            goStore: function () {
            	var storeId = this.s_id;
            	uni.navigateTo({
            		url: '/pages/goods/goods?storeId=' + storeId + '&sid=index',
            	})
            },
    	}
    }
</script>
<style>
    page{
        background-color: #999;
    }
</style>
<style lang="scss" scoped>
	@import '../index.scss';
</style>
